#ifndef YIGSYNTHBUTTON_H
#define YIGSYNTHBUTTON_H

#include <QPushButton>
#include <QString>
#include <QDrag>
#include <QDropEvent>

/**
*   YigSynthButton defines the buttons in the synth object menu. Can be drag/dropped in the gui to create new synths
*/
class YigSynthButton : public QPushButton
{
    Q_OBJECT

public:

    /**
    *   YigSynthButton constructor
    *   @param QString name Name of the synth button, also corresponds with the name of the associated synth object.
    *   @param QWidget *parent Parent gui object containing this button
    */
    explicit YigSynthButton(QString name, QWidget *parent = 0);

    /**
    *   getName Get the name of this SynthButton
    *   @return QString mName of this synthButton
    */
    QString getName();

signals:

    /** overridden signal. We add the name of the synth to the emitted signal
    *   @param QString synthname
    */
    void pressed(QString synthName);

public slots:

protected:

    /** Overridden method from parent to emit pressed with the synth name */
    void mousePressEvent(QMouseEvent *e);
    /** Overridden method to facilitate drag and drop */
    void mouseMoveEvent(QMouseEvent *e);

private:

    /** called when Dragging */
    void performDrag();

    /** Name of the synth button, also corresponds with the name of the associated synth object. */
    QString mName;
    /** used to measure the distance of mouse movement to check if we are initiating a drag */
    QPoint startPos;

};

#endif // YIGSYNTHBUTTON_H
